<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="msg">
        <!-- 输完内容, 按回车才会生效 -->
        <input v-model.lazy="msg">
        <!-- 输入的是数字 -->
        <input v-model.number="msg">
        <!-- 清除前后空格 -->
        <input v-model.trim="msg">
        <p>{{ msg }}</p>

        <!-- 多个复选框, 使用列表保存 -->
        <!-- label 中for属性关联了id, 会将label中的数绑定到checkedNames数组 -->
        <input type="checkbox" id="jack" value="Jack" v-model="checkedNames">
        <label for="jack">Jack</label>
        <input type="checkbox" id="john" value="John" v-model="checkedNames">
        <label for="john">John</label>
        <input type="checkbox" id="mike" value="Mike" v-model="checkedNames">
        <label for="mike">Mike</label>
        <br>
        <span>Checked names: {{ checkedNames }}</span>
        <br>

        <select v-model="selected">
            <option disabled value="">请选择</option>
            <option>A</option>
            <option>B</option>
            <option>C</option>
        </select>
        <span>Selected: {{ selected }}</span>
        
    </div>
    <script src="./vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data() {
                return {
                    msg:"",
                    checkedNames: [],
                    selected:"",
                }
            },
        })
    </script>
</body>
</html>